package com.demo.morning;

/**
 * @ClassName 初始并发问题
 * @Description TODO
 * @Author tianqinglong
 * @Date 9:30 2022/7/13
 * @Version 1.0
 **/
public class 初始并发问题  implements Runnable{
private int tickNums=10;

    @Override
    public void run() {
        while (true){
            if(tickNums<0){
                break;
            }
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+"--拿到了第"+tickNums--+"票");
        }
    }

    public static void main(String[] args) {
        初始并发问题 thread1 = new 初始并发问题();
        new Thread(thread1,"1").start();
        new Thread(thread1,"2").start();
        new Thread(thread1,"3").start();
    }
}
